Jon's Git Node
Commit fe1605c2b25f718e9d2a96571caadb650bb5622b
Parents : 567c1ce
Author : Jonathan Lamothe <jonathan@jlamothe.net>
Date : 2026-09-16T19:52:25-04:00
added Browser.highlight_markup
...it doesn't *do* anything yet.
Changes
Diff
diff --git a/nomadnet/ui/textui/Browser.py b/nomadnet/ui/textui/Browser.py
index 5439e9e..b3e5759 100644
--- a/nomadnet/ui/textui/Browser.py
+++ b/nomadnet/ui/textui/Browser.py
@@ -1121,7 +1121,12 @@ class Browser:
if endpos-(pos+len(tag)) in (3, 6):
setattr(self, attr, markup[pos+len(tag):endpos])
try:
- self.attr_maps = markup_to_attrmaps(strip_modifiers(markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ self.attr_maps = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(markup)),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
except Exception as e:
self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render preview: {e}"), "browser_inactive")]
self.update_page_display()
@@ -1274,7 +1279,12 @@ class Browser:
partial["updated"] = partial["update_requested"]
partial["request_id"] = None
partial["content"] = request_receipt.response.decode("utf-8").rstrip()
- partial["attr_maps"] = markup_to_attrmaps(strip_modifiers(partial["content"]), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ partial["attr_maps"] = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(partial["content"])),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
pile = partial["pile"]
pile.contents = [(e, pile.options()) for e in partial["attr_maps"]]
self.refresh_page_layout()
@@ -1846,7 +1856,12 @@ class Browser:
fg = self.markup[fgpos+5:endpos]
self.page_foreground_color = fg
- try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ try: self.attr_maps = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(self.markup)),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "browser_inactive")]
self.response_progress = 0
@@ -1925,7 +1940,12 @@ class Browser:
fg = self.markup[fgpos+5:endpos]
self.page_foreground_color = fg
- try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ try: self.attr_maps = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(self.markup)),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "browser_inactive")]
self.response_progress = 0
@@ -2089,7 +2109,12 @@ class Browser:
fg = self.markup[fgpos+5:endpos]
self.page_foreground_color = fg
- try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ try: self.attr_maps = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(self.markup)),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "browser_inactive")]
self.response_progress = 0
@@ -2215,7 +2240,12 @@ class Browser:
try:
if isinstance(request_receipt.response, bytes):
markup = request_receipt.response.decode("utf-8")
- self.attr_maps = markup_to_attrmaps(strip_modifiers(markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
+ self.attr_maps = markup_to_attrmaps(
+ strip_modifiers(self.highlight_markup(markup)),
+ url_delegate=self,
+ fg_color=self.page_foreground_color,
+ bg_color=self.page_background_color
+ )
elif type(request_receipt.response) == io.BufferedReader:
if request_receipt.metadata != None:
@@ -2389,6 +2419,9 @@ class Browser:
def show_find(self):
self.search_widget.show()
+ def highlight_markup(self, markup):
+ return markup
+
class SearchWidget:
def __init__(self, browser):
Served by rngit 1.5.4 - Generated in 0.04s